/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Aug 13, 2009 12:54:04 AM $
 *
 * Author: Eric Yang
 * Date  : Aug 13, 2009 12:54:04 AM
 *
 */
package com.gooex.web.action.manage.category;

import com.gooex.domain.base.Category;
import com.gooex.service.base.exception.CategoryException;
import com.gooex.web.action.BaseManageableAction;


/**
 * @author Eric Yang
 * @version 1.0
 */
public class RemoveCategory extends BaseManageableAction {

	private Category category;

	public String execute() throws Exception {
		try {
			category = categoryManager.getCategory(category.getId());
			if (category == null) {
				addActionError(getText("category.not.exist"));
				return ERROR;
			}
			categoryManager.removeCategory(category);
		} catch (CategoryException e) {
			addActionError(e.getMessage());
			return ERROR;
		}
		return SUCCESS;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

}
